<template>
  <el-form label-position="top" :model="formData">
    <el-form-item label="用户名">
      <el-input v-model="formData.userName" placeholder="请输入用户名"></el-input>
    </el-form-item>
    <el-form-item label="邮箱">
      <el-input v-model="formData.email" placeholder="请输入邮箱"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="formData.password" placeholder="请输入密码" type="password" show-password></el-input>
    </el-form-item>
    <el-form-item label="确认密码">
      <el-input v-model="formData.passwordRepeat" placeholder="请再次输入密码" type="password" show-password></el-input>
    </el-form-item>
<!--      <el-button type="primary" @click="registerOnClick">注册</el-button>-->
    <span style="display: flex; justify-content: center; width: 100%; margin-top: 50px">
      <my-button type="primary" :width="300" :height="35" @click="registerOnClick">注册</my-button>
    </span>
  </el-form>
</template>

<script>
import {useAccountStore} from "@/stores/account";
import MyButton from "@/components/common/myButton.vue";

export default {
  name: "RegisterForm",
  components: {MyButton},
  data() {
    return {
      formData: {
        userName: "",
        email: "",
        password: "",
        passwordRepeat: "",
      },
    };
  },
  methods: {
    async registerOnClick() {
      const accountStore = useAccountStore();
      const response = await accountStore.register(this.formData.userName, this.formData.email, this.formData.password, this.formData.passwordRepeat);
    }
  }
}
</script>

<style scoped>

</style>